package gui;

import java.sql.SQLException;

import com.trolltech.qt.gui.*;

public class fenetreAdmin extends QWidget {
	
	public fenetreAdmin() {
		
    	/** admin GroupBox' **/
        QGroupBox adminGroup = new QGroupBox(tr("Administrateur"));

        /* Bouton Tirage */
        QPushButton boutonTirage = new QPushButton("Gérer les tirages");
        boutonTirage.clicked.connect(this, "gererTirage()"); 
 
        /* Bouton Tirage */
        QPushButton boutonStats = new QPushButton("Afficher les statistiques");
        boutonStats.clicked.connect(this, "afficherStats()");        
      
        // Dialog Layout
        QVBoxLayout adminLayout = new QVBoxLayout();
        adminLayout.addWidget(boutonTirage);
        adminLayout.addWidget(boutonStats);
        adminGroup.setLayout(adminLayout);
        
        QVBoxLayout layout = new QVBoxLayout();
        layout.addWidget(adminGroup);
        setLayout(layout);
	}
	
	/*
	 * Accède à l'écran Gestion Tirage
	 */
	public void gererTirage() throws SQLException {
		fenetreTirage fenetre = new fenetreTirage() ;
		QMainWindow menuPrincipal = (QMainWindow) this.parentWidget() ;
		menuPrincipal.setCentralWidget(fenetre) ;
	}
	
	public void afficherStats() throws SQLException {
		fenetreStats fenetre = new fenetreStats() ;
		QMainWindow menuPrincipal = (QMainWindow) this.parentWidget() ;
		menuPrincipal.setCentralWidget(fenetre) ;
	}

}
